package com.alg.local.gateway.web;

import cn.hutool.json.JSONUtil;
import com.alg.local.gateway.entity.GatewayRouterConfig;
import com.alg.local.gateway.entity.JustTest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author al
 * @date 2022/5/30 14:22
 * @description
 */
@Slf4j
@RestController
public class JustTestController {

    @Autowired
    GatewayRouterConfig gatewayRouterConfig;

    @Autowired
    JustTest justTest;

    @GetMapping("/testReadConfig")
    public String testReadConfig() {
        log.info("读取到的数据：{}", JSONUtil.toJsonStr(gatewayRouterConfig.getRoutes()));
        log.info("读取到的第二份配置：{}", justTest.getTest());
        return JSONUtil.toJsonStr(gatewayRouterConfig.getRoutes());
    }
}
